<template>
  <el-container style=" border: 1px solid #eee;background-color: white">
    <el-aside  width="200px" style="background-color: rgb(238, 241, 246);line-height: 60px">
      <h5>菜单栏</h5>
      <el-menu
          default-active="$route.path"
          class="el-menu-vertical-demo"
          router>
        <!-- v-if="isAdmin===true" -->
        <el-menu-item index="1" route="/allMessages" @click="this.tag='博客管理'">
          <i class="el-icon-menu"></i>
          <span slot="title">博客管理</span>
        </el-menu-item>


<!--        <el-menu-item index="3" route="/category" >-->
<!--          <i class="el-icon-location"></i>-->
<!--          <span slot="title">用户管理</span>-->
<!--        </el-menu-item>-->

        <el-menu-item index="4" route="/comment"  @click="this.tag='评论管理'">
          <i class="el-icon-s-order"></i>
          <span slot="title">评论管理</span>
        </el-menu-item>

<!--        <el-menu-item index="5" route="/filemanage">-->
<!--          <i class="el-icon-document"></i>-->
<!--          <span slot="title">文件管理</span>-->
<!--        </el-menu-item>-->

        <el-menu-item index="6" route="/user">
          <i class="el-icon-user-solid"></i>
          <span slot="title">用户管理</span>
        </el-menu-item>
        <el-menu-item index="/admin/tag" >
          <i class="el-icon-collection"></i>
          <span slot="title">标签管理</span>
        </el-menu-item>
        <el-menu-item index="11" route="/link"  >
          <i class="el-icon-location"></i>
          <span slot="title">链接管理</span>
        </el-menu-item>
<!--        <el-menu-item index="5" route="/"  >-->
<!--          <i class="el-icon-location"></i>-->
<!--          <span slot="title">分类管理</span>-->
<!--        </el-menu-item>-->
        <el-menu-item index="10" route="/category"  >
          <i class="el-icon-location"></i>
          <span slot="title">分类管理</span>
        </el-menu-item>

        <!--        <el-menu-item index="7" route="/description">-->
        <!--          <i class="el-icon-setting"></i>-->
        <!--          <span slot="title">系统说明</span>-->
        <!--        </el-menu-item>-->

        <el-menu-item index="8" route="/" @click="clearToken">
          <i class="el-icon-setting"></i>
          <span slot="title" @click="clearToken">退出管理</span>
        </el-menu-item>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right;
    font-size: 15px;
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;">
        <span><h1>{{this.tag}}</h1></span>
        <span>{{ who }} 欢迎您！</span>
      </el-header>

      <el-main style="padding: 0;">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "AdminComponent",
  data() {
    return {
      isAdmin: window.localStorage.getItem('power') === '系统管理员',
      who: window.localStorage.getItem('ms_username'),
      tag:""
    }
  },
  methods: {

    clearToken() {
      this.$store.commit('$_removeStorage');    // 清除登录信息
      localStorage.removeItem('power')
    }
  },
  mounted() {
    // this.who=window.localStorage.getItem('ms_username');
  }

}
</script>

<style lang="scss" scoped>
.el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
    height: 100vh;
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>
